#!/bin/bash

#变量定义
ip_array=("59.110.157.44" "59.110.161.22")
user="root"
remote_cmd="sh -x /root/workspace/deploy/deploy.sh link-api product"

#本地通过ssh执行远程服务器的脚本
for ip in ${ip_array[*]}
do
    if [ $ip = "192.168.1.1" ]; then
        port="7777"
    else
        port="22"
    fi
    ssh -tt -p $port $user@$ip <<EOF
        $remote_cmd
        exit
EOF
done